import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import './assets/styles/theme/index.css'
import './assets/styles/index.less'
import Lodash from 'lodash'
import NP from 'number-precision'
// import Filters from './filters/index'
import operate from './directive/operate'
import echarts from 'echarts'
// import * as echarts from 'echarts'
import 'echarts/map/js/china.js'
import 'echarts-liquidfill'
import 'amfe-flexible'

import Bus from './utils/bus'
import './permission' // permission control

// 引入字体库"DIN Condensed"
import './assets/styles/common/fonts/font.css'

import i18n from '@/lang/index'

// 引入自动滚动鼠标滚动
import VueScroll from '@david-j/vue-j-scroll'
Vue.use(VueScroll)

Bus(Vue)

window._ = Lodash
ElementUI.Dialog.props.closeOnClickModal.default = false
Vue.use(operate)
Vue.use(ElementUI)
// Vue.use(ElementUI, { size: 'mini' })
Object.defineProperty(Vue.prototype, '$NP', { value: NP })
Object.defineProperty(Vue.prototype, '$goBack', {
  value: function() {
    window.history.go(-1)
  }
})
Vue.config.productionTip = false
Vue.prototype.$showLoading = function() {
  store.commit('updateLoading', true)
}
Vue.prototype.$echarts = echarts
Vue.prototype.$hideLoading = function() {
  store.commit('updateLoading', false)
}

Vue.prototype.msgSuccess = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'success' })
}

Vue.prototype.msgError = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'error' })
}
Vue.prototype.msgWarn = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'warning', offset: 400 })
}

Vue.prototype.msgInfo = function(msg) {
  this.$message.info(msg)
}

// for (const key in Filters) {
//   Vue.filter(key, Filters[key])
// }

document.title = 'X in 1自动检测设备'

new Vue({
  i18n,
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
